package com.gy.zpchat.ui.search.adapter.holder;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import im.zego.zim.entity.ZIMConversationSearchInfo;
import com.gy.zpchat.R;
import com.gy.zpchat.ui.search.adapter.OnItemClickListener;

public class ConversationViewHolder extends RecyclerView.ViewHolder {

    TextView conversationName;
    TextView content;

    Context context;

    public ConversationViewHolder(ViewGroup parent, OnItemClickListener onItemClickListener,
                                  Context context) {
        super(LayoutInflater.from(parent.getContext())
                  .inflate(R.layout.item_search_conversation_view, parent, false));
        conversationName = itemView.findViewById(R.id.conversation_name);
        this.context = context;
        content = itemView.findViewById(R.id.content);
    }

    public void setConversationInfo(ZIMConversationSearchInfo globalSearchInfo) {
        conversationName.setText(globalSearchInfo.getConversationID());
        content.setText(globalSearchInfo.getTotalMessageCount() +
                        (context.getText(R.string.total_message_count_description).toString()));
    }
}
